// Copyright © SixtyFPS GmbH <info@slint.dev>
// SPDX-License-Identifier: MIT

import { DemoPalette, Page, SpinBox, Label, ComboBox, PushButton, CheckBox } from "./common.slint";
import { PrinterQueue } from "./printer_queue.slint";


export component CopyPage inherits Page {
    has-back-button: true;
    header: @tr("Copy");

    GridLayout {
        padding-top: 46px /* header line height in design */
                     + /* extra top-padding in design */ 27px;
        spacing: 24px;
        Row {
            Text {
                text: @tr("Choose Settings");
                color: DemoPalette.secondary-foreground-color;
                font-size: DemoPalette.base-font-size * 1.125;
                font-weight: 800;
            }
        }
        Row {
            Label { text: @tr("Copies"); }
            SpinBox {
                value: 1;
                minimum: 1;
            }

            Rectangle {}

            Label { text: @tr("Size"); }
            ComboBox {
                value: @tr("DIN A4");
                choices: [@tr("DIN A4"), @tr("DIN A3"), @tr("Letter")];
            }
        }
        Row {
            Label { text: @tr("Layout"); }
            ComboBox {
                value: @tr("Portrait");
                choices: [@tr("Portrait"), @tr("Landscape")];
            }

            Rectangle {}

            Label { text: @tr("Paper Tray"); }
            ComboBox {
                value: @tr("Special Tray");
                choices: [@tr("Special Tray"), @tr("Normal Tray")];
            }
        }
        Row {
            Label { text: @tr("Quality"); }
            ComboBox {
                value: @tr("Best");
                choices: [@tr("Best"), @tr("Medium"), @tr("Draft")];
            }

            Rectangle {}

            Label { text: @tr("Paper Type"); }
            ComboBox {
                value: @tr("Standard");
                choices: [@tr("Standard"), @tr("Non-standard")];
            }
        }
        Row {
            Label { text: @tr("Color"); }
            ComboBox {
                value: @tr("Grayscale");
                choices: [@tr("Grayscale"), @tr("Color")];
            }

            Rectangle {}

            Label { text: @tr("Paper Handling"); }
            CheckBox {
                checked: true;
                text: @tr("Sort Pages");
            }
        }
        Row {
            HorizontalLayout {
                col: 3;
                colspan: 2;

                Rectangle {
                    horizontal-stretch: 0;
                    width: 10%;
                }
                PushButton {
                    icon: @image-url("images/copy.svg");
                    text: @tr("Start copying");
                    clicked => {
                        PrinterQueue.start-job(@tr("Copy"));
                    }
                }
                Rectangle {
                    horizontal-stretch: 0;
                    width: 10%;
                }
            }
        }
        Row { Rectangle {} }
    }
}
